home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: netcom.com!ERICKPAR
- From: erk@netcom.com (Staugher)
- Subject: How to dynamically allocate first element of linked list.
- Message-ID: <erkDL007G.rt@netcom.com>
- Sender: erk@netcom9.netcom.com
- Organization: Martians for Earth Colonization
- X-Newsreader: News Xpress Version 1.0 Beta #4
- Date: Thu, 11 Jan 1996 00:48:04 GMT
-
- Im trying (without any luck )to write a function to allocate the first element
- of a doubly linked list in C++. Unfortunately I learned data structures in
- Pascal and have to port my knowledge (or lack of ) to C.
-
- Here is my arrangement:
-
-
- struct elmnt
- { char name[20];
- char number[17];
- struct elmnt *forward_pointer;
- struct elmnt *reverse_pointer;
- }
-
- //======================================
-
- main()
- {
- struct elmnt *list = newlist(void)
- }
-
- //======================================
-
- struct elmnt * newlist(void)
- {
- struct elmnt *newptr;
- newptr = malloc(sizeof(struct elmnt));
- return (newptr);
- }
-
- //=======================================
-
-
- The compiler complains with an ERROR that it cannot convert
- (void *) to (elmnt *) in function newlist
-
- I hope that the problem is obvious to someone :/
-
- ADV thanks ANCE
-
-